Arithmetic operators
Example
w
Shorthand operations are usually very efficient and they
can be combined with another expression.
X = A * B++; is equivalent to
X = A * B;
w
B = B+1;
w
X = A * ++B; is equivalent to
B=B+1;
w
X=A*B;
w
X = --C * (A + B); is equavalent to
C = C – 1;
w
X = C * (A + B);
w
X = C-- * (A + B); is equavalent to
X = C * (A + B);
C = C – 1;
Versions where the operator occurs before the variable name change the value of the variable before evaluating the expression.